//待接单

import { baseApi, baseApp } from '@/server/base'

export default [
  /**
   * 进行 Orders动作
   * @returns
   */
  {
    url: /\/apis\/api\/apk\/tasks\/accept\/[0-9]*/,
    type: 'post',
    response: () => {
      return {
        code: 200,
        data: {
          id: 3,
          mcr_id: 1112,
          type: 'Jam',
          block: null,
          prod: 'B106_CP1',
          location: '{"block":null,"x":5,"y":3}',
          machine: 'SUZAMDASLT278',
          short: 'ASLT278',
          contents: {
            id: 1112,
            jam: 'Multile--Multile Bin X move',
            category: 'handler',
            qty: 8,
            days: 3,
            rate: 0.67,
            goal: null,
            gth_goal: 0.67
          },
          urgent: 1,
          tags: null,
          shift: 'D',
          start: '2023-02-16 07:00:00',
          week: 'WW:07',
          date: '2023-02-16',
          publish_by: '441343',
          publish_at: '2023-02-16 10:05:58',
          owner_id: '503417',
          owner: 'Wang, JingPing',
          transfer_from: null,
          transfer_apply_at: null,
          transferd_by: null,
          transfer_pid: null,
          state: 2,
          cancel_reason: null,
          cancel_reason_other: null,
          cancel_at: null,
          completed_at: null,
          canceled_at: null,
          score: 0,
          system_state: 1,
          accepted_at: '2023-02-16 14:27:53',
          created_at: '2023-02-16 10:06:00',
          updated_at: '2023-02-16 14:27:53',
          deleted_at: null,
          deleted_by: null,
          deleted_reason: null
        },
        msg: ''
      }
    }
  },

  /**
   * 获取待接单信息
   * @param params
   * @returns
   */
  {
    url: `${baseApi}/api/apk/tasks/pending`,
    type: 'get',
    response: () => {
      return {
        code: 200,
        data: [
          {
            id: 17,
            owner: 'nan, weiqiang',
            completed_at: null,
            updated_at: '2023-02-21 16:54:25',
            machine: 'SUZAMDASLT114',
            block: null,
            type: 'Jam',
            prod: 'C437_D202SL_EFUSE',
            urgent: 1,
            state: 1,
            created_at: '2023-02-21 16:54:25',
            contents: {
              id: 24,
              jam: 'No 3  Tester socket IC put jam',
              category: 'position',
              qty: 5,
              days: 1,
              rate: 0.42,
              goal: null,
              gth_goal: 0.42
            },
            system_state: 1,
            cancel_state: null,
            reject_reason: null,
            transfer_owner: 'deng,xiaowei',
            short: 'ASLT114'
          }
        ],
        msg: ''
      }
    }
  },
  /**
   * 获取取消或转交的原因
   */
  {
    url: `${baseApi}/api/apk/configs/reasons`,
    type: 'get',
    response: () => {
      return {
        code: 200,
        data: [
          {
            kpi: 'Jam',
            type: '申请转交',
            list: [
              {
                id: 1,
                kpi: 'Jam',
                type: '申请转交',
                content: 'item01',
                option_type: 1,
                sort: 0,
                created_at: '2023-01-31 14:18:29',
                updated_at: '2023-01-31 14:18:29'
              },
              {
                id: 4,
                kpi: 'Jam',
                type: '申请转交',
                content: 'item5',
                option_type: 1,
                sort: 1,
                created_at: '2023-01-31 14:18:52',
                updated_at: '2023-01-31 14:18:52'
              },
              {
                id: 3,
                kpi: 'Jam',
                type: '申请转交',
                content: 'item4',
                option_type: 1,
                sort: 2,
                created_at: '2023-01-31 14:18:29',
                updated_at: '2023-01-31 14:18:41'
              }
            ]
          }
        ],
        msg: ''
      }
    }
  },

  /**
   * 取消申请 或 转单
   * @param params
   * @returns
   */
  {
    url: /\/apis\/api\/apk\/tasks\/cancel\/[0-9]*/,
    type: 'post',
    response: () => {
      return {
        code: 200,
        data: {
          id: 11,
          mcr_id: 86,
          type: 'Jam',
          block: null,
          prod: 'B106_BB2',
          location: '{"block":null,"x":"2","y":"5"}',
          machine: 'SUZAMDASLT249',
          short: 'ASLT249',
          contents: {
            id: '86',
            jam: 'AOI Inspection Error - Input Retry Total Failures=2',
            category: 'AOI',
            qty: '1',
            days: '1',
            rate: '0.08',
            goal: null,
            gth_goal: '0.08'
          },
          urgent: 1,
          tags: null,
          shift: 'B',
          start: '2023-02-21 07:00:00',
          week: 'WW:08',
          date: '2023-02-21',
          publish_by: 'test',
          publish_at: '2023-02-21 15:25:43',
          owner_id: '101323',
          owner: 'deng,xiaowei',
          transfer_owner: null,
          transfer_owner_id: null,
          transfer_apply_at: null,
          transferd_by: null,
          transfer_pid: null,
          state: 1,
          completed_at: null,
          jam_method: null,
          jam_method_other: null,
          reject_img_id: null,
          cancel_at: '2023-02-21 16:09:47',
          cancel_reason_other: null,
          cancel_reason: '["\\u9e45\\u9e45\\u9e45\\u9e45\\u9e45\\u9e45"]',
          cancel_state: 5,
          cancel_img_id: null,
          reject_reason: 'reject reason ',
          canceled_at: '2023-02-21 16:27:17',
          canceled_by: 'test',
          score: 0,
          system_state: 1,
          accepted_at: null,
          created_at: '2023-02-21 15:25:44',
          updated_at: '2023-02-21 16:27:17',
          deleted_at: null,
          deleted_by: null,
          deleted_reason: null
        },
        msg: ''
      }
    }
  }
]
